package cn.linkai.star.graph.core.advice;

import cn.linkai.star.graph.core.dto.common.Result;
import lombok.extern.slf4j.Slf4j;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class CommonExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public ResponseEntity commonException(Exception e){
        log.error("[commonException]:",e);
        return ResponseEntity.status (HttpStatus.OK.value ()).body (Result.error (e.getLocalizedMessage ()));
    }
}
